#ifndef TRANSACTION_TRANSACTION_LIST_H
#define TRANSACTION_TRANSACTION_LIST_H 1

#include <common/macro/build.h>
#include <transaction/types.h>
#include <transaction/transactionlog.h>

typedef struct transaction_list_t {
	transaction_phase_e *phases;
	int phases_c;

	transaction_id_t first_id, last_id;

	transaction_id_t vacuum_id;
	transaction_id_t wraparound;
} transaction_list_t;

API_LIBLOCAL transaction_list_t *transaction_list_new();
API_LIBLOCAL void transaction_list_destroy(transaction_list_t *);
API_LIBLOCAL int transaction_list_refresh(transaction_list_t *, transaction_log_t *);
API_LIBLOCAL int transaction_list_compare_ids(transaction_list_t *, transaction_id_t, transaction_id_t);
API_LIBLOCAL transaction_id_t transaction_list_last_finished(transaction_list_t *);
API_LIBLOCAL int transaction_list_query(transaction_list_t *, transaction_id_t, transaction_phase_e *);

#endif
